using System;
using Science.Mathematics;
using L=Science.Physics.GeneralPhysics;

namespace Serway.Chapter10
{
	/// <summary>
	/// Example01: Rotating Wheel
	/// A wheel rotates with a constant angular acceleration 
	/// of 3.50 rad/s^2.
	/// (A) If the angular speed of the wheel is 2.00 rad/s 
	/// at t_i = 0 s through what angular displacement does 
	/// the wheel rotate in 2.00 s?
	/// \Delta \theta = 11.0 rad
	/// (B) Through how many revolutions has the wheel turned 
	/// during this interval?
	/// 1.75 rev
	/// (C) What is the angular speed of the wheel at t = 2.00 s?
	/// \omega_f = 9.0 rad/s
	/// </summary>
	public class Example01
	{
		public Example01()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
		public void Compute()
		{
			L.Time ti = new L.Time();
			ti.s = 0.0;
			L.Time tf = new L.Time();
			tf.s = 2.0;
			L.Vector.FunctionOfTime func = new L.Vector.FunctionOfTime(f);
			L.AngularVelocity omega = new L.AngularVelocity();
            omega.VectorFunctionOfTime = func;
			L.AngleVector thetai = new L.AngleVector();
			thetai.Z = 0.0;
			L.AngleVector theta = new L.AngleVector(ti,thetai,omega,tf);
            result+=Convert.ToString(theta.Z)+"      (A)\r\n";
			result+=Convert.ToString(theta.Z/2.0/Math.PI)+"       (B)\r\n";
			result+=Convert.ToString(omega.VectorFunctionOfTime(tf).Z)+"        (C)\r\n";
		}
		private L.Vector f(L.Time t)
		{
			L.Vector x = new L.Vector();
			x.Z = 2.0+3.5*t.s;
			return x;
		}
	}
}
